Optimal. Leaf size=48 \[ -\frac {a^2 \log (\cos (e+f x))}{f}+\frac {a b \sec ^2(e+f x)}{f}+\frac {b^2 \sec ^4(e+f x)}{4 f} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.03, antiderivative size = 48, normalized size of antiderivative = 1.00, number of steps
used = 4, number of rules used = 3, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.143, Rules used = {4223, 272, 45}
\begin {gather*} -\frac {a^2 \log (\cos (e+f x))}{f}+\frac {a b \sec ^2(e+f x)}{f}+\frac {b^2 \sec ^4(e+f x)}{4 f} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 45
Rule 272
Rule 4223
Rubi steps
\begin {align*} \int \left (a+b \sec ^2(e+f x)\right )^2 \tan (e+f x) \, dx &=-\frac {\text {Subst}\left (\int \frac {\left (b+a x^2\right )^2}{x^5} \, dx,x,\cos (e+f x)\right )}{f}\\ &=-\frac {\text {Subst}\left (\int \frac {(b+a x)^2}{x^3} \, dx,x,\cos ^2(e+f x)\right )}{2 f}\\ &=-\frac {\text {Subst}\left (\int \left (\frac {b^2}{x^3}+\frac {2 a b}{x^2}+\frac {a^2}{x}\right ) \, dx,x,\cos ^2(e+f x)\right )}{2 f}\\ &=-\frac {a^2 \log (\cos (e+f x))}{f}+\frac {a b \sec ^2(e+f x)}{f}+\frac {b^2 \sec ^4(e+f x)}{4 f}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.13, size = 82, normalized size = 1.71 \begin {gather*} -\frac {\left (b+a \cos ^2(e+f x)\right )^2 \left (-b^2-4 a b \cos ^2(e+f x)+4 a^2 \cos ^4(e+f x) \log (\cos (e+f x))\right ) \sec ^4(e+f x)}{f (a+2 b+a \cos (2 (e+f x)))^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.06, size = 41, normalized size = 0.85
method | result | size |
derivativedivides | \(\frac {\frac {\left (\sec ^{4}\left (f x +e \right )\right ) b^{2}}{4}+\left (\sec ^{2}\left (f x +e \right )\right ) a b +a^{2} \ln \left (\sec \left (f x +e \right )\right )}{f}\) | \(41\) |
default | \(\frac {\frac {\left (\sec ^{4}\left (f x +e \right )\right ) b^{2}}{4}+\left (\sec ^{2}\left (f x +e \right )\right ) a b +a^{2} \ln \left (\sec \left (f x +e \right )\right )}{f}\) | \(41\) |
risch | \(i a^{2} x +\frac {2 i a^{2} e}{f}+\frac {4 b \left (a \,{\mathrm e}^{6 i \left (f x +e \right )}+2 a \,{\mathrm e}^{4 i \left (f x +e \right )}+b \,{\mathrm e}^{4 i \left (f x +e \right )}+a \,{\mathrm e}^{2 i \left (f x +e \right )}\right )}{f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{4}}-\frac {a^{2} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}{f}\) | \(104\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.26, size = 71, normalized size = 1.48 \begin {gather*} -\frac {2 \, a^{2} \log \left (\sin \left (f x + e\right )^{2} - 1\right ) + \frac {4 \, a b \sin \left (f x + e\right )^{2} - 4 \, a b - b^{2}}{\sin \left (f x + e\right )^{4} - 2 \, \sin \left (f x + e\right )^{2} + 1}}{4 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 3.07, size = 57, normalized size = 1.19 \begin {gather*} -\frac {4 \, a^{2} \cos \left (f x + e\right )^{4} \log \left (-\cos \left (f x + e\right )\right ) - 4 \, a b \cos \left (f x + e\right )^{2} - b^{2}}{4 \, f \cos \left (f x + e\right )^{4}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A]
time = 0.30, size = 61, normalized size = 1.27 \begin {gather*} \begin {cases} \frac {a^{2} \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac {a b \sec ^{2}{\left (e + f x \right )}}{f} + \frac {b^{2} \sec ^{4}{\left (e + f x \right )}}{4 f} & \text {for}\: f \neq 0 \\x \left (a + b \sec ^{2}{\left (e \right )}\right )^{2} \tan {\left (e \right )} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 334 vs.
\(2 (46) = 92\).
time = 0.58, size = 334, normalized size = 6.96 \begin {gather*} \frac {2 \, a^{2} \log \left ({\left | -\frac {\cos \left (f x + e\right ) + 1}{\cos \left (f x + e\right ) - 1} - \frac {\cos \left (f x + e\right ) - 1}{\cos \left (f x + e\right ) + 1} + 2 \right |}\right ) - 2 \, a^{2} \log \left ({\left | -\frac {\cos \left (f x + e\right ) + 1}{\cos \left (f x + e\right ) - 1} - \frac {\cos \left (f x + e\right ) - 1}{\cos \left (f x + e\right ) + 1} - 2 \right |}\right ) + \frac {3 \, a^{2} {\left (\frac {\cos \left (f x + e\right ) + 1}{\cos \left (f x + e\right ) - 1} + \frac {\cos \left (f x + e\right ) - 1}{\cos \left (f x + e\right ) + 1}\right )}^{2} + 12 \, a^{2} {\left (\frac {\cos \left (f x + e\right ) + 1}{\cos \left (f x + e\right ) - 1} + \frac {\cos \left (f x + e\right ) - 1}{\cos \left (f x + e\right ) + 1}\right )} - 16 \, a b {\left (\frac {\cos \left (f x + e\right ) + 1}{\cos \left (f x + e\right ) - 1} + \frac {\cos \left (f x + e\right ) - 1}{\cos \left (f x + e\right ) + 1}\right )} - 8 \, b^{2} {\left (\frac {\cos \left (f x + e\right ) + 1}{\cos \left (f x + e\right ) - 1} + \frac {\cos \left (f x + e\right ) - 1}{\cos \left (f x + e\right ) + 1}\right )} + 12 \, a^{2} - 32 \, a b}{{\left (\frac {\cos \left (f x + e\right ) + 1}{\cos \left (f x + e\right ) - 1} + \frac {\cos \left (f x + e\right ) - 1}{\cos \left (f x + e\right ) + 1} + 2\right )}^{2}}}{4 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 4.50, size = 61, normalized size = 1.27 \begin {gather*} \frac {a^2\,\ln \left ({\mathrm {tan}\left (e+f\,x\right )}^2+1\right )}{2\,f}-\frac {{\mathrm {tan}\left (e+f\,x\right )}^2\,\left (\frac {b^2}{2}-b\,\left (a+b\right )\right )}{f}+\frac {b^2\,{\mathrm {tan}\left (e+f\,x\right )}^4}{4\,f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________